package com.example.gulimall.cart.config;

import com.example.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MallWebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //将这个拦截器放进去，addPathPatterns指定拦截那些请求，”/**"拦截该项目下所有请求
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
